<?php

namespace App\Console\Commands;

use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Auth;

class CreateJwt extends Command
{
    protected $signature = 'user:jwt';

    protected $description = '生成用户的jwt';

    public function handle()
    {
        $userId=$this->ask("请输入生成的用户id");
        //获取用户的信息
        $user=User::find($userId);
        $jwt=\auth('api')->setTTL(365*24*60)->login($user);
        $this->info($jwt);
    }
}
